//获得页面元素
var box=document.getElementById('box');

var ullist=document.getElementsByClassName('ullist');
var xiaodl=document.getElementsByClassName('xiaodl');
 //给小点图标加点击事件
 for(k=0;k<xiaodl.length;k++){
 	click(k);
 }
  function click(k){
  	 xiaodl[k].onclick=function(){
  	 	num=k;
  	 	run();
  	 }
  }
  var buttonleft=document.getElementById('buttonleft');
      buttonleft.onclick=function(){
      	if(num==0){
      		num=ullist.length-2;
      	}else if(num==1){
      		num=ullist.length-1;

      	}else{num-=2;}
      	  run();
      }
  var buttonright=document.getElementById('buttonright');
      buttonright.onclick=function(){
      	run();
      }
//让所有的图片一秒中轮流转换
    num=0;
    function run(){
      //让所有的文件隐藏
    	for(var i=0;i<ullist.length;i++){
  		     ullist[i].style.display='none';
  		     xiaodl[i].style.background='gray';
    	  }
    	xiaodl[num].style.background='white';
    	ullist[num].style.display='block';
   	 if(num==ullist.length-1){
     	   num=0
    	 }else{
    	 	num++;
   	 }
    }
    run()
   time=setInterval(run,1000);
   box.onmouseover=function(){
    	clearInterval(time);
    }
     box.onmouseout=function(){
       time=setInterval(run,3000);  
    }

